回答編集履歴
3
修正
answer
CHANGED
@@ -34,11 +34,10 @@
|
|
34
34
|
$(function(){
|
35
35
|
$('#target').on('mouseover', function(){
|
36
36
|
$('#svg').css('visibility', 'visible');
|
37
|
-
vivus.play();
|
37
|
+
vivus.reset().play();
|
38
38
|
});
|
39
39
|
$('#target').on('mouseout', function(){
|
40
40
|
$('#svg').css('visibility', 'hidden');
|
41
|
-
vivus.reset();
|
42
41
|
});
|
43
42
|
});
|
44
43
|
</script>
|
2
修正
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
vivus.jsというライブラリで簡単に実現できます。illustratorで作ったパスファイルの`<svg>`タグの部分を抜き取ってhtmlに貼り付けてください。
|
1
|
+
[vivus.js](https://github.com/maxwellito/vivus#timing-function)というライブラリで簡単に実現できます。illustratorで作ったパスファイルの`<svg>`タグの部分を抜き取ってhtmlに貼り付けてください。
|
2
2
|
|
3
3
|
|
4
4
|
```html
|
1
修正
answer
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
```html
|
5
|
-
<!-- vivus
|
5
|
+
<!-- vivus,jQuery読み込み -->
|
6
6
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/vivus/0.4.4/vivus.js"></script>
|
7
|
+
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
|
8
|
+
crossorigin="anonymous"></script>
|
7
9
|
|
8
|
-
|
9
10
|
<svg version="1.1" id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
|
10
11
|
y="0px" width="237.26px" height="422.36px" viewBox="0 0 237.26 422.36" enable-background="new 0 0 237.26 422.36"
|
11
12
|
xml:space="preserve">
|
@@ -15,12 +16,30 @@
|
|
15
16
|
<circle fill="none" stroke="#000000" stroke-width="4" stroke-miterlimit="10" cx="198.5" cy="353.5" r="6.25"/>
|
16
17
|
</svg>
|
17
18
|
|
19
|
+
<button style = "background: #000; width: 100px; height: 50px;" id = "target"></button>
|
20
|
+
|
21
|
+
<style>
|
22
|
+
#svg {
|
23
|
+
visibility: hidden;
|
24
|
+
}
|
25
|
+
</style>
|
26
|
+
|
18
27
|
<script>
|
19
|
-
new Vivus('svg', {
|
28
|
+
const vivus = new Vivus('svg', {
|
20
29
|
type: 'oneByOne',
|
21
30
|
duration: 200,
|
22
31
|
animTimingFunction:Vivus.EASE_OUT,
|
23
32
|
});
|
33
|
+
|
34
|
+
$(function(){
|
35
|
+
$('#target').on('mouseover', function(){
|
36
|
+
$('#svg').css('visibility', 'visible');
|
37
|
+
vivus.play();
|
38
|
+
});
|
39
|
+
$('#target').on('mouseout', function(){
|
40
|
+
$('#svg').css('visibility', 'hidden');
|
41
|
+
vivus.reset();
|
42
|
+
});
|
43
|
+
});
|
24
44
|
</script>
|
25
|
-
|
26
45
|
```
|