-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d0b17b
commit 6d84094
Showing
5 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
background: white; | ||
} | ||
|
||
h1 { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.content { | ||
padding: 10px 10px; | ||
margin: 20px 50px 20px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.content img { | ||
max-height: 100%; | ||
max-width: 90%; | ||
box-shadow: 0px 0px 6px 0px #a5a5a5; | ||
border-radius: 5px; | ||
padding: 20px; | ||
} | ||
|
||
.content canvas { | ||
max-height: 100%; | ||
max-width: 90%; | ||
box-shadow: 0px 0px 6px 0px #a5a5a5; | ||
border-radius: 5px; | ||
padding: 20px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Pict2Pix.js</title> | ||
<link rel="stylesheet" media="screen" href="css/style.css"/> | ||
</head> | ||
<body> | ||
<h1>Pict2Pix.js</h1> | ||
<div class="content" id="div1"> | ||
<img id="image-jh" src="images/jimi-hendrix.jpg"> | ||
</div> | ||
<div class="content">Always working</div> | ||
<div class="content" id="div2"> | ||
<img id="image-ay" src="images/angus-young.jpg"> | ||
</div> | ||
<div class="content">Working when the mouse is over the picture</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/gh/evaristocuesta/pict2pix@0.2.0/dist/pict2pix.min.js"></script> | ||
|
||
<script src="js/app.js"></script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const imagejh = document.getElementById('image-jh'); | ||
|
||
window.onload = function initialize() { | ||
pict2pix.animate({ | ||
image: imagejh, | ||
numberOfParticles: 800, | ||
horizontalSpeed: -1, | ||
verticalSpeed: -1, | ||
particleType: 'twisted-particle' | ||
}); | ||
} | ||
|
||
const imageay = document.getElementById('image-ay'); | ||
const div2 = document.getElementById('div2'); | ||
|
||
div2.onmouseenter = function over() { | ||
pict2pix.animate({ | ||
image: imageay, | ||
numberOfParticles: 800, | ||
horizontalSpeed: 1, | ||
verticalSpeed: 1, | ||
particleType: 'straight-particle' | ||
}); | ||
} | ||
|
||
div2.onmouseleave = function out() { | ||
pict2pix.stop(imageay.id); | ||
} |