Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Floating Expression

New Here ,
May 26, 2016 May 26, 2016

Greetings community,

i found an expression that makes a floating animation with consistant oscillations.

xAmp = 3; //height of undulations (pixels)

xFreq = .3; //undulations per second

xSpeed = 150; //speed of wave (pixels per second)

wl = xSpeed/xFreq; //wavelength (pixels)

phaseOffset = ((position[0]%wl)/wl)*2*Math.PI;

y = xAmp*Math.sin(2*Math.PI*xFreq*time + phaseOffset);

value + [0,y]

This expression does the oscillations only on the Y axes.

My question:

Is there a way to make the expression do the oscillation not just on Y, but also on the X axes at the same time?

TOPICS
Expressions
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 27, 2016 May 27, 2016

Simply re-use the y variable twice in the last line: value + [y,y]. It's not going to look particularly good, though, since it will effectively only "rotate" the effect by 45 degrees. You should duplicate the wave code and use different values for the x coordinates.

Mylenium

Translate
LEGEND ,
May 27, 2016 May 27, 2016
LATEST

Simply re-use the y variable twice in the last line: value + [y,y]. It's not going to look particularly good, though, since it will effectively only "rotate" the effect by 45 degrees. You should duplicate the wave code and use different values for the x coordinates.

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines