当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript velocity-animate.default函数代码示例

本文整理汇总了TypeScript中velocity-animate.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Velocity

QUnit.test("End Value Caching", (assert) => {
	const done = assert.async(2),
		newProperties = {height: "50px", width: "250px"};

	assert.expect(4);

	/* Called after the last call is complete (stale). Ensure that the newly-set (via $.css()) properties are used. */
	Velocity(getTarget(newProperties), defaultProperties)
		.then((elements) => {
			assert.equal(Data(elements[0]).cache.width, defaultProperties.width, "Stale end value #1 wasn't pulled.");
			assert.equal(Data(elements[0]).cache.height, defaultProperties.height, "Stale end value #2 wasn't pulled.");

			done();
		});

	Velocity(getTarget(), defaultProperties)
		.velocity(newProperties)
		.then((elements) => {
			/* Chained onto a previous call (fresh). */
			assert.equal(Data(elements[0]).cache.width, newProperties.width, "Chained end value #1 was pulled.");
			assert.equal(Data(elements[0]).cache.height, newProperties.height, "Chained end value #2 was pulled.");

			done();
		});
});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:25,代码来源:End+Value+Caching.ts

示例2: asyncTests

	asyncTests(assert, 1, (done) => {
		const $target = getTarget();

		Velocity($target, defaultProperties, defaultOptions);
		Velocity($target, {top: 0}, defaultOptions);
		Velocity($target, {width: 0}, defaultOptions);
		Velocity($target, "stop");
		assert.ok(true, "Calling on an element that is animating doesn't cause an error.");

		done();
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:11,代码来源:Command+Stop.ts

示例3: asyncTests

	asyncTests(assert, 1, (done) => {
		let success = false;

		try {
			success = true;
			Velocity(getTarget(), defaultProperties, {easing: ["a" as any, 0.5, 0.5, 0.5]});
			Velocity(getTarget(), defaultProperties, {easing: [0.5, 0.5, 0.5]});
		} catch (e) {
			success = false;
		}
		assert.ok(success, "Invalid bezier curve didn't throw error.");

		done();
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:14,代码来源:Option+Easing.ts

示例4: asyncTests

	asyncTests(assert, 4, (done) => {
		const testOptions = {loop: 2, delay: 100, duration: 100},
			start = getNow();
		let begin = 0,
			complete = 0,
			loop = 0,
			lastPercentComplete = 2;

		Velocity(getTarget(), defaultProperties,
			{
				loop: testOptions.loop,
				delay: testOptions.delay,
				duration: testOptions.duration,
				begin() {
					begin++;
				},
				progress(elements, percentComplete) {
					if (lastPercentComplete > percentComplete) {
						loop++;
					}
					lastPercentComplete = percentComplete;
				},
				complete() {
					complete++;
				},
			})
			.then(() => {
				assert.equal(begin, 1, "Begin callback only called once.");
				assert.equal(loop, testOptions.loop * 2 - 1, "Animation looped correct number of times (once each direction per loop).");
				assert.close(getNow() - start, (testOptions.delay + testOptions.duration) * loop, 32, "Looping with 'delay' has correct duration.");
				assert.equal(complete, 1, "Complete callback only called once.");

				done();
			});
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:35,代码来源:Option+Loop.ts

示例5: asyncTests

	asyncTests(assert, 4, (done) => {
		const testOptions = {repeat: 2, delay: 100, duration: 100},
			start = Date.now();
		let begin = 0,
			complete = 0,
			repeat = 0;

		Velocity(getTarget(), defaultProperties, {
			repeat: testOptions.repeat,
			delay: testOptions.delay,
			duration: testOptions.duration,
			begin() {
				begin++;
			},
			progress(elements, percentComplete) {
				if (percentComplete === 1) {
					repeat++;
				}
			},
			complete() {
				complete++;
				assert.equal(begin, 1, "Begin callback only called once.");
				assert.equal(repeat, testOptions.repeat + 1, "Animation repeated correct number of times (original plus repeats).");
				assert.close(Date.now() - start, (testOptions.delay + testOptions.duration) * (testOptions.repeat + 1), (testOptions.repeat + 1) * 16 + 32,
					"Repeat with 'delay' has correct duration.");
				assert.equal(complete, 1, "Complete callback only called once.");

				done();
			},
		});
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:31,代码来源:Option+Repeat.ts

示例6: asyncTests

	asyncTests(assert, 2, (done) => {
		Velocity($target, "reverse", {
			complete(elements) {
				assert.equal(elements[0].velocity("style", "opacity"), defaultProperties.opacity, `Chained reversed property #1 set correctly. (${defaultProperties.opacity})`);
				assert.equal(elements[0].velocity("style", "width"), defaultProperties.width, `Chained reversed property #2 set correctly. (${defaultProperties.width})`);

				done();
			},
		});
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:10,代码来源:Command+Reverse.ts

示例7: asyncTests

	asyncTests(assert, 1, async (done) => {
		const $target = getTarget(),
			$targetSet = [getTarget(), $target, getTarget()];
		let complete = false;

		Velocity($target, defaultProperties, {
			duration: 300,
			complete() {
				complete = true;
			},
		});
		Velocity($targetSet, defaultProperties, {
			sync: false,
			duration: 250,
		});
		await sleep(275);
		assert.notOk(complete, "Sync 'false' animations don't wait for completion.");

		done();
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:20,代码来源:Option+Sync.ts

示例8: asyncTests

	asyncTests(assert, 1, (done) => {
		const $targetSet = [getTarget(), getTarget()];

		Velocity($targetSet, defaultProperties, {
			duration: asyncCheckDuration,
			complete(elements) {
				assert.deepEqual(elements, $targetSet, "Elements passed into callback.");

				done();
			},
		});
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:12,代码来源:Option+Complete.ts

示例9: once

QUnit.test("Visibility", (assert) => {
	const done = assert.async(4);

	Velocity(getTarget(), "style", "visibility", "hidden")
		.velocity({visibility: "visible"}, {
			progress: once((elements: VelocityResult) => {
				assert.equal(elements.velocity("style", "visibility"), "visible", "Visibility:'visible' was set immediately.");

				done();
			}),
		});

	Velocity(getTarget(), "style", "visibility", "hidden")
		.velocity("style", "visibility", "")
		.then((elements) => {
			// NOTE: The test elements inherit "hidden", so while illogical it
			// is in fact correct.
			assert.equal(elements.velocity("style", "visibility"), "hidden", "Visibility:'' was reset correctly.");

			done();
		});

	Velocity(getTarget(), {visibility: "hidden"}, {
		progress: once((elements: VelocityResult) => {
			assert.notEqual(elements.velocity("style", "visibility"), "visible", "Visibility:'hidden' was not set immediately.");

			done();
		}),
	})
		.then((elements) => {
			assert.equal(elements.velocity("style", "visibility"), "hidden", "Visibility:'hidden' was set upon completion.");

			done();
		});
});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:35,代码来源:Property+Visibility.ts

示例10: getTarget

	asyncTests(assert, 2, (done) => {
		const $target = getTarget();

		Velocity($target, "pause");
		assert.ok(true, "Calling \"pause\" on an element that isn't animating doesn't cause an error.");
		Velocity($target, "resume");
		assert.ok(true, "Calling \"resume\" on an element that isn't animating doesn't cause an error.");

		done();
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:10,代码来源:Command+Pause+++Resume.ts

示例11: sleep

	asyncTests(assert, 1, async (done) => {
		const $target = getTarget();

		Velocity($target, {opacity: 0}, {queue: "test", duration: 250});
		Velocity("pause", "test");
		await sleep(300);
		assert.equal(getPropertyValue($target, "opacity"), "1", "Pause 'queue' works globally.");

		done();
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:10,代码来源:Command+Pause+++Resume.ts

示例12: sleep

	asyncTests(assert, 1, async (done) => {
		const $target = getTarget();

		Velocity($target, {left: "500px"}, {duration: 10});
		await sleep(100);
		Velocity($target, {left: 0}, {duration: 10});
		await sleep(1000);
		assert.equal(getPropertyValue($target, "left"), "0px", "Finished animated value given as number 0 should be the same as 0px.");

		done();
	});
开发者ID:jamesgeorge007,项目名称:velocity,代码行数:11,代码来源:Unit+Calculation.ts

示例13: open

 open() {
     if (!this.active) {
         this.active = true;
         var reveal: HTMLElement = this.$els.reveal;
         if (reveal) {
             reveal.style.display = 'block';
             Velocity(reveal, "stop", false);
             Velocity(reveal, {translateY: '-100%'}, {duration: 300, queue: false, easing: 'easeInOutQuad'});
         }
     }
 }
开发者ID:gustaYo,项目名称:vue-chess,代码行数:11,代码来源:index.ts

示例14: setTimeout

 setTimeout(function() {
     if (started != true) {
         Velocity(tooltip, {opacity: 0, marginTop: 0, marginLeft: 0}, { duration: 225, queue: false});
         Velocity(backdrop, {opacity: 0, scale: 1}, {
             duration: 225,
             queue: false,
             complete: function() {
                 backdrop.style.display = 'none';
                 tooltip.style.display = 'none';
                 started = false;
             }
         });
     }
 }, 225);
开发者ID:gustaYo,项目名称:vue-chess,代码行数:14,代码来源:index.ts

示例15: open

    open() {
        if (!this.active) {
            this.active = true;

            var offsetY, offsetX;

            if (this.horizontal) {
                offsetX = 40;
            } else {
                offsetY = 40;
            }

            var items = Array.prototype.slice.call(this.$el.querySelectorAll('ul .btn-floating'));

            Velocity(items,
                {scaleY: ".4", scaleX: ".4", translateY: offsetY + 'px', translateX: offsetX + 'px'},
                {duration: 0});

            var time = 0;
            items.reverse().forEach(function (item) {
                Velocity(item,
                    {opacity: "1", scaleX: "1", scaleY: "1", translateY: "0", translateX: '0'},
                    {duration: 80, delay: time});
                time += 40;
            });
        }
    }
开发者ID:MarxJiao,项目名称:material-components,代码行数:27,代码来源:index.ts


注:本文中的velocity-animate.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。