Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
unicar9 committed Apr 9, 2019
1 parent 7ef310a commit c51bf5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
23 changes: 4 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,13 @@
<script src="index.js"></script>
</head>
<body>

<div class="colorName"></div>
<div class="container">

<div class="container">
<span class="icon-play" id="move"></span>
<span class="icon-download3" id="save"></span>
<span class="icon-cog" id="config"></span>
</div>

<div class="menu">
<div>
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
自动播放动画
</label>
</div>
<div>
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
颜色名称不消失
</label>
</div>
</div>

</body>
</html>
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ function setup() {
growMountains()
mountains.forEach(m => m.display())

noLoop()
if (isMoving) {
loop()
} else {
noLoop()
}
}


Expand All @@ -70,17 +74,16 @@ window.onload = function () {
saveCanvas(canvas, 'jizhi-bg', 'jpg')
})

document.querySelector('#move').addEventListener('click', () => {
const moveBtn = document.querySelector('#move')

moveBtn.addEventListener('click', () => {
isMoving = !isMoving

if (isMoving) {
loop()
} else {
noLoop()
}

const moveBtn = document.querySelector('#move')

moveBtn.classList.toggle('icon-pause2')
moveBtn.classList.toggle('icon-play')
})
Expand Down

0 comments on commit c51bf5e

Please sign in to comment.