商品 | 价格 | 图片 |
---|
var liElements = document.querySelectorAll ('li');
var tbodyElements = document.querySelector('.table tbody');
liElements.forEach(function (li) {
soldOut(li);
} );
function soldOut(li) {
/*
* 以其中给一个li来做逻辑处理
* */
var buttonElement = li.querySelector('button ');
var text1Element = li.QuerySelector('.text1'); ;
var timeSpanElement = li.querySelectorAll('.time span');
var warenName = li.querySelector('.goods_name').innerHTML;
vargoodsImg = li.querySelector('.img').src;
/*
* */
buttonElement.onclick = function() {
var seconds = parseInt(text1Element.value);
/*
* */
var timer = setInterval(function () {
seconds--;
if (seconds >= 0) {
timeArr.forEach(function (item, index) {
});
} else {
//时间到了
clearInterval(timer);
timeOver();
add2List();
}
function timeOver() {
// maskElement.style.opacity = '0.5';
anim ation(maskElement, {
Deckkraft: 0,5
}, 500);
soldOutElement.style.display = 'block';
Breite: 198,
Höhe: 198,
links: 61,
oben: 76,
Deckkraft: }, 500, 'bounceOut');
setTimeout(function () {
shake (li, 'links', 20, 2);
}
/*
* 添加当前的商品信息到表格列表中
function add2List() {
tbodyElements.innerHTML += '
var trElements = tbodyElements.querySelectorAll('tr');
Das zuletzt hinzugefügte Element
// Konsole .log(trElements[trElements.length - 1]);
// animation(trElements[trElements.length - 1], {
// Deckkraft: 1
// }, 100);
var H = addZero(parseInt(seconds / 3600));
var M = addZero(parseInt(seconds % 3600 / 60)); (seconds % 60));
return H + M + S;
function addZero(v) {
}
/*
* Zittern!
* */
/*
* Ermitteln Sie die Position des Elements vor dem Schütteln
var originValue = getCss (element, attr); function() {
🎜> element.style[ attr] = originValue + range + 'px';
Element. style[attr] = originValue + 'px';
>
}
function getCss(element, attr) {
function animation(ele , attrs, duration, fx, callback) {
if (ele. timer) {
return; = {};
obj[attr].b = parseFloat(getComputedStyle(ele)[attr ]); obj[attr].c = attrs[attr] - obj[attr].b;
}
var callback = callback | |. function(){};
var startTime = Date.now();
ele.timer = setInterval(function () {
var t = Date.now () - startTime;
if (t >= d) {
}
for (var attr in attrs) {
var value = Tween[fx](t, obj[attr].b, obj[attr].c, d);
if (attr == 'opacity') {
ele.style[attr] = value;
} else {
ele.style[attr] = value + 'px';
} }
}
var Tween = {
linear: function (t, b, c, d){ //Konstante Geschwindigkeit
return c*t/d + b;
},
equalIn: function ( t, b, c, d){ //Beschleunigungskurve
return c*(t/=d)*t + b; //t/=d t = t / d
},
equalOut : function(t, b, c, d){ //Verzögerungskurve
return -c *(t/=d)*(t-2) + b;
},
easeBoth: function( t, b, c, d){ //Beschleunigungs- und Verzögerungskurve
return -c/2 * ((--t)*(t-2) - 1) + b;
} ,
equalInStrong: function(t, b, c, d){ // Ruckkurve
return c*(t/=d)*t*t*t + b;
},
easyOutStrong: function(t, b, c, d){ //Verzögerungskurve
return -c * ((t=t/d-1)*t*t*t - 1) + b;
} ,
equalBothStrong: function(t, b, c, d){ //Beschleunigungs- und Verzögerungskurve
if ((t/=d/2) < 1) {
return c/2*t *t*t*t + b;
}
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
elasticIn : function(t, b, c, d, a, p){ //Sinusförmige Abklingkurve (Bounce-Einblendung)
if (t === 0) {
return b; c;
}
if (!p) {
Math.abs(c )) {
a = c;
var s = p/4;
var s = p/(2*Math.PI) * Math.asin (c/a) ;
}
return -(a*Math.pow(2,10*(t-=1 )) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
elasticOut: function(t, b, c, d, a, p ){ //Sinusförmige Verstärkungskurve (Bounce Out)
if (t === 0) {
return b; {
P = d*0.3}
if ( ! A ||. a & lt; math.abs (c)) {
a = c; var s = p / 4; * Math.sin( (t*d-s)*(2* Math.PI)/p ) + c + b;
},
elasticBoth: function(t, b, c, d, a, p) {
if (t === 0) {
return b;
}
if ( (t /= d/2) == 2 ) {
return b+c;
}
if (!p) {
p = d*(0,3*1,5); ;> A = c;
var s = p/4;
Else {
var s = p/(2 * math.pi ) * math.asin (c/a);
}
if (t < 1) {
return - 0.5*(a*Math.pow(2,10*(t-=1) ) *
Math.sin( (t *d-s)*(2*Math.PI)/p )) + b;
}
return a*Math.pow(2,-10*(t -=1)) *
Math. sin( (t*d-s)*(2*Math.PI)/p )*0,5 + c + b;
},
backIn: function(t, b, c, d, s){ // Rücklaufbeschleunigung (schrittweises Zurückspulen)
if (typeof s == 'undefiniert') {
s = 1.70158;
}
return c*(t/=d)*t*((s+1)*t - s) + b;
},
backOut: function(t, b, c, d, s){
if (typeof s == 'undefiniert') {
s = 3.70158; //回缩的距离
}
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
} ,
backBoth: function(t, b, c, d, s){
if (typeof s == 'undefiniert') {
s = 1.70158;
}
if (( t /= d/2 ) < 1) {
return c/2*(t*t*(((s*=(1,525))+1)*t - s)) + b;
}
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
bounceIn: function(t, b, c, d){ //弹球减振(弹球渐出)
return c - Tween['bounceOut'](d-t, 0, c, d) + b;
},
bounceOut: function(t, b, c, d){
if ((t/=d) < (1/2.75)) {
return c*(7.5625* t*t) + b;
} else if (t < (2/2,75)) {
return c*(7,5625*(t-=(1,5/2,75))*t + 0,75) + b ;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + 0.9375) + b;
}
return c*(7.5625*(t-=(2.625/2.75))*t + 0.984375) + b;
},
bounceBoth: function(t, b, c, d){
if (t < d/2) {
return Tween['bounceIn'](t*2, 0, c, d) * 0.5 + b;
}
return Tween['bounceOut'] (t*2-d, 0, c, d) * 0,5 + c*0,5 + b;
}
};
Das obige ist der detaillierte Inhalt vonProduktion von Spezialeffekten zur Produktentfernung: Timer, Countdown, Dithering-Spezialeffektcode. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!