Created
November 25, 2019 12:14
-
-
Save acro5piano/204a9ddff867eb4b1e5899894da719e4 to your computer and use it in GitHub Desktop.
Vue.js Image Rotator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<meta http-equiv="X-UA-Compatible" content="IE=11" /> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> | |
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> | |
<link rel="icon" type="shortcut icon" href="https://gym-checkin.nupp1.io/favicon.ico"> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<title>Nupp1 Payment</title> | |
<style> | |
body { | |
font-family: 'Roboto', 'ヒラギノ角ゴ Pro', 'Hiragino Kaku Gothic Pro', 'メイリオ', Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif; | |
background: #fff; | |
color: #555; | |
} | |
body,h1,h2,h3,h4,h5,h6,p,div { | |
font-size: 13px; | |
font-weight: normal; | |
} | |
* { | |
line-height: 1.67 !important; | |
box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
-webkit-box-sizing: border-box; | |
-o-box-sizing: border-box; | |
-ms-box-sizing: border-box; | |
} | |
@font-face { | |
font-family: 'Material Icons'; | |
font-style: normal; | |
font-weight: 400; | |
src: local('Material Icons'), local('MaterialIcons-Regular'); | |
} | |
a, a:visited { | |
text-decoration: none; | |
color: inherit; | |
} | |
textarea { | |
line-height: 1.6 !important; | |
font-size: 16px !important; | |
} | |
.btn { | |
padding: 8px 12px; | |
color: #fff; | |
border: none; | |
border-radius: 3px; | |
font-size: 16px; | |
} | |
.btn.btn-primary { | |
background: rgb(15, 94, 127); | |
} | |
.btn.btn-secondary { | |
background: rgb(255, 158, 80); | |
} | |
.wrapper { | |
padding: 16px; | |
text-align: center; | |
} | |
.container { | |
padding: 16px; | |
max-width: 1024px; | |
} | |
.image-wrap { | |
height: 400px; | |
width: 400px; | |
overflow: scroll; | |
padding: 50px; | |
box-sizing: content-box; | |
} | |
.image { | |
height: 90%; | |
margin: auto; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="rotator"> | |
<div class="wrapper"> | |
<div class="container"> | |
<div class="image-wrap"> | |
<img class="image" :style="{ transform: `skew(${skew}deg) skewy(${skewy}deg) rotate(${rotate}deg)`, }" src="https://user-images.githubusercontent.com/10719495/69536331-2447a000-0fc1-11ea-92d2-abd470620e45.png"> | |
</div> | |
<div class="container"> | |
<button class="btn btn-secondary" @click="rotateMinusMore">- 10deg</button> | |
<button class="btn btn-secondary" @click="rotateMinus">- 5deg</button> | |
<button class="btn btn-primary" @click="rotatePlus">+ 5deg</button> | |
<button class="btn btn-primary" @click="rotatePlusMore">+ 10deg</button> | |
</div> | |
<div class="container"> | |
<button class="btn btn-secondary" @click="skewMinus">- skew X</button> | |
<button class="btn btn-primary" @click="skewPlus">+ skew X</button> | |
</div> | |
<div class="container"> | |
<button class="btn btn-secondary" @click="skewyMinus">- skew Y</button> | |
<button class="btn btn-primary" @click="skewyPlus">+ skew Y</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
<script> | |
new Vue({ | |
data() { | |
return { | |
rotate: 0, | |
skew: 0, | |
skewy: 0, | |
} | |
}, | |
mounted() { | |
}, | |
methods: { | |
skewPlus() { | |
this.skew -= 2 | |
}, | |
skewMinus() { | |
this.skew += 2 | |
}, | |
skewyPlus() { | |
this.skewy -= 2 | |
}, | |
skewyMinus() { | |
this.skewy += 2 | |
}, | |
rotatePlusMore() { | |
this.rotate -= 10 | |
}, | |
rotatePlus() { | |
this.rotate -= 5 | |
}, | |
rotateMinus() { | |
this.rotate += 5 | |
}, | |
rotateMinusMore() { | |
this.rotate += 10 | |
}, | |
} | |
}).$mount('#rotator') | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment