-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcolor.html
58 lines (51 loc) · 1.84 KB
/
color.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>avalon.fn.delay</title>
<script src="avalon.js"></script>
<script>
require(["mmAnimate"], function(avalon) {
var getRandomColor = function() {
return '#'+('00000'+(Math.random()*0x1000000<<0).toString(16)).slice(-6);
}
avalon.define("fx", function(vm) {
vm.effect = function() {
avalon(this).animate({backgroundColor: getRandomColor()}, 1000)
}
})
avalon.scan()
})
</script>
<style type="text/css">
#sample {
position: relative;height: 90px;
}
#sample div { position: absolute; width: 60px; height: 60px; float: left; }
.first { background-color: #3f3; left: 0;}
</style>
</head>
<body>
<article>
<h3>颜色的动画</h3>
<fieldset ><legend>例子</legend>
<pre class="brush:javascript;gutter:false;toolbar:false">
require(["mmAnimate"], function(avalon) {
var getRandomColor = function() {
return '#'+('00000'+(Math.random()*0x1000000<<0).toString(16)).slice(-6);
}
avalon.define("fx", function(vm) {
vm.effect = function() {
avalon(this).animate({background: getRandomColor()}, 1000)
}
})
avalon.scan()
})
</pre>
<div id="sample" ms-controller="fx">
<div class="first" ms-click="effect">点我</div>
</div>
</fieldset>
</article>
</body>
</html>