How to use the popmotion.tween function in popmotion

To help you get started, we’ve selected a few popmotion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brunnolou / react-morph / examples / demo / src / Morph.js View on Github external
});

			const fadeIn = keyframes({
				values: [{ opacity: 0 }, { opacity: 1 }],
				easings: easing.linear
				// times: [0.9, 1]
			});

			// const fadeInOnce = onceDifferent(s => {
			// 	console.log("s: ", s);
			// 	fadeIn.start(targetStyler.set);
			// });
			// fadeOut.start(cloneStyler.set);

			// Image bg fix.
			const bgFix = tween({
				from: diffTargetStyles.scaleX * 1000,
				to: 100,
				easings: easing.linear
			})
				.start(s => {
					// if (key === 'cover') console.log('s: ', s);
					originalClone.style.backgroundSize = `${s}% 100%`;
				})
				.pause();

			// tween({
			// 	from: diffTargetStyles.scaleY * 1000,
			// 	to: 100,
			// 	easings: easing.linear,
			// 	duration
			// }).start(s => {
github Popmotion / popmotion / packages / site / templates / Popmotion / LiveExamples / Three.js View on Github external
scene.add(gridHelper);
      
      // Add lights
      const spotLight = new THREE.SpotLight(0xffffff);
      spotLight.position.set(100, 1000, 100);
      scene.add(spotLight);
      const spotLight2 = new THREE.SpotLight(0xffffff);
      spotLight2.position.set(100, -1000, 100);
      scene.add(spotLight2);
      
      // Render loop
      const render = () => renderer.render(scene, camera);
      everyFrame().start(render);
      
      // Rotate camera
      tween({
        from: 0,
        to: 360,
        loop: Infinity,
        ease: easing.linear,
        duration: 12000
      }).start(cameraRotation);

      // Bounce ball
      const gravity = physics({
        from: sphereY.get(),
        acceleration: - 9.8,
        restSpeed: false
      }).start((v) => {
        if (v <= 1) {
          v = 1;
          gravity.setVelocity(10);
github HuijiFE / void-ui / src / controls / layout / carousel / VdCarousel.tsx View on Github external
left.styler.set('x', `${x - 100}%`);
              right.styler.set('x', `${x + 100}%`);
            }
        : (left &&
            (x => {
              toShow.styler.set('x', `${x}%`);
              left.styler.set('x', `${x - 100}%`);
            })) ||
          (right &&
            (x => {
              toShow.styler.set('x', `${x}%`);
              right.styler.set('x', `${x + 100}%`);
            })) ||
          (x => toShow.styler.set('x', `${x}%`));

    popmotion
      .tween({
        from: start,
        to: 0,
        ease,
        // duration,
        duration: (duration * Math.abs(start)) / 100,
      })
      .start({
        update,
        complete: () => {
          this.isMoving = false;
          this.delta = 0;
        },
      });
  }
github freenas / webui / src / app / core / directives / animation.directive.ts View on Github external
flipH(reverse?:boolean){
    //DEBUG: console.log("**** FLIP ANIMATION ****");

    let start: number;
    let finish: number;

    if(!reverse){
      start = 0;
      finish = -180;
    } else {
      start = -180;
      finish = 0;
    }
    let s = tween({
      from: { rotateY: start, scale:1},
      to: { rotateY: finish, scale: 1 },
      //ease: easing.easeInOut,
      //flip: 0,
      duration: 500
    })
     return s;
  }
github freenas / webui / src / app / core / directives / animation.directive.ts View on Github external
flipV(reverse?:boolean){
    //DEBUG: console.log("**** FLIP ANIMATION ****");

    let start: number;
    let finish: number;

    if(!reverse){
      start = 0;
      finish = -180;
    } else {
      start = -180;
      finish = 0;
    }
    let s = tween({
      from: { rotateX: start, scale:1},
      to: { rotateX: finish, scale: 1 },
      //ease: easing.easeInOut,
      //flip: 0,
      duration: 500
    })
     return s;
  }
github lennerd / git-for-beginners / src / components / VisualisationPointer.js View on Github external
position => {
        tween({
          from: this.position.get(),
          to: position,
          duration: 1000,
          ease: easing.easeInOut,
        }).start(this.position);
      },
      { equals: comparer.structural },
github phmatray / openjam / src / views / not-found / KawaiiAnimation.js View on Github external
const closeMouth = tween({
      from: { scaleY: 1 },
      to: { scaleY: 0.3 },
      duration: 300,
      flip: 1,
    });

    const tongueDisappear = tween({
      from: { scaleY: 1 },
      to: { scaleY: 0 },
      duration: 300,
      flip: 1,
    });

    tween({
      from: { y: 10 },
      to: { y: 20 },
      easings: easing.easeOut,
      duration: 1500,
      yoyo: Infinity,
    }).start(body.set);

    const eyeLeftAction = action(({ complete }) => {
      showEye.start({
        update: eyeLeft.set,
        complete: () => {
          complete();
          setInterval(() => blinkEye.start({ update: eyeLeft.set }), 2000);
        },
      });
    });
github freenas / webui / src / app / core / directives / animation.directive.ts View on Github external
shakeAnimation(){
    const s = tween({
      from: { rotate: -1.25, scale:1},
      to: { rotate: 1.25, scale: 1 },
      //ease: easing.easeInOut,
      flip: Infinity,
      duration: 100
    });

    const startShaking = () => { 
      const a = s.start({
        update:this.elStyler.set
      });
      return a;
    }

    if(!this.shaking){
      this.shaking  = startShaking();
github brunnolou / react-morph / examples / demo / src / Morph.js View on Github external
const fadeOuts = this.fadeOutElements.map(({ element, options = {} }) =>
			tween({
				from: 1,
				to: 0,
				ease: easing.linear,
				duration: duration / 2,
				...options
			}).start(v => (element.style.opacity = v))
		);
github skellock / typescript-with-electron-react-kit / src / renderer / platform / components / spin-animation / spin-animation-state.ts View on Github external
const createState = (to: number) => (e: StateChangeEvent) =>
    tween({
      from: e.value.get(),
      to,
      duration,
      onUpdate: e.value,
    }).start()