Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
creepyface
Advanced tools
Creepyface is a little JavaScript tool that makes your face look at the pointer (or a [firefly](https://github.com/4lejandrito/creepyface-firefly)). It is ideal for resumes, team presentation sites, etc...
Creepyface is a little JavaScript tool that makes your face look at the pointer (or a firefly). It is ideal for resumes, team presentation sites, etc...
Creepyface in the wild:
The simplest way to create your Creepyface is by using our wizard.
If you want to customize it even more you can use our declarative data-attribute API:
Take a bunch of pictures of yourself looking at different directions.
Create a standard <img>
tag like the following using the pictures you just took:
<img
data-creepyface
src="img/face/serious.jpg"
data-src-hover="img/face/crazy.jpg"
data-src-look-0="img/face/north.jpg"
data-src-look-45="img/face/north-east.jpg"
data-src-look-90="img/face/east.jpg"
data-src-look-135="img/face/south-east.jpg"
data-src-look-180="img/face/south.jpg"
data-src-look-225="img/face/south-west.jpg"
data-src-look-270="img/face/west.jpg"
data-src-look-315="img/face/north-west.jpg"
/>
The data-src-look
attributes must be set to degrees (0 - 360).
Include Creepyface script in your page:
<script src="https://creepyface.io/creepyface.js"></script>
Creepyface will automatically detect your image (thanks to the data-creepyface
attribute) and make it look at the mouse or fingers depending on which device you are using.
You can add as many Creepyfaces as you want as long as they all have the data-creepyface
attribute.
If you want to stop Creepyface on a given image:
creepyface.cancel(document.querySelector('img'))
Name | Description |
---|---|
data-creepyface | Add this to automatically attach creepyface to your image when the page loads. |
data-src-hover | The URL of the image to use when the pointer is over your image. |
data-src-look-<angle> | The URL of the image to use when the pointer forms the specified angle (in degrees) with the center of your image. Add as many as you want. |
data-timetodefault | The amount of time (in milliseconds) after which the default src is restored if no pointer events are received. 1 second by default. 0 means it will never be restored (the image will always look at the pointer). |
data-throttle | The amount of time (in milliseconds) to wait between src changes. 100 by default. |
data-points | Optionally, a comma-separated list of point provider names to make your face look at things other than the pointer. See Super advanced usage for more information. |
For more advanced use cases Creepyface can also be set up via a programmatic API:
import creepyface from 'creepyface'
const img = document.querySelector('img#face')
const cancel = creepyface(img, {
// Time (in ms) to wait between src updates
throttle: 100,
// Image URL to display on hover
hover: 'img/face/crazy.jpg',
// Each of the images looking at a given direction
looks: [
{ angle: 0, src: 'img/face/north.jpg' },
{ angle: 45, src: 'img/face/north-east.jpg' },
{ angle: 90, src: 'img/face/east.jpg' },
{ angle: 135, src: 'img/face/south-east.jpg' },
{ angle: 180, src: 'img/face/south.jpg' },
{ angle: 225, src: 'img/face/south-west.jpg' },
{ angle: 270, src: 'img/face/west.jpg' },
{ angle: 315, src: 'img/face/north-west.jpg' }
],
// Time (in ms) to restore the default image after the last input
timeToDefault: 1000
})
// at some point restore the original image and stop creepyface
cancel()
Creepyface will look at the pointer by default, however custom point providers can be defined.
For example, to make your face look at a random point every half a second (see codepen) you need to register a point provider:
import creepyface from 'creepyface'
creepyface.registerPointProvider('random', (consumer, img) => {
const interval = setInterval(
() =>
consumer([
Math.random() * window.innerWidth,
Math.random() * window.innerHeight
]),
500
)
return () => {
clearInterval(interval)
}
})
and consume it using the data-points
attribute:
<img
data-creepyface
data-points="random"
src="img/face/serious.jpg"
data-src-hover="img/face/crazy.jpg"
data-src-look-0="img/face/north.jpg"
data-src-look-45="img/face/north-east.jpg"
data-src-look-90="img/face/east.jpg"
data-src-look-135="img/face/south-east.jpg"
data-src-look-180="img/face/south.jpg"
data-src-look-225="img/face/south-west.jpg"
data-src-look-270="img/face/west.jpg"
data-src-look-315="img/face/north-west.jpg"
/>
or pass it programmatically:
const img = document.querySelector('img#face')
creepyface(img, {
// Provides the points to look at
points: (consumer, img) => {
const interval = setInterval(
() =>
consumer([
Math.random() * window.innerWidth,
Math.random() * window.innerHeight
]),
500
)
return () => {
clearInterval(interval)
}
},
// Image URL to display on hover
hover: 'img/face/crazy.jpg',
// Each of the images looking at a given direction
looks: [
{ angle: 0, src: 'img/face/north.jpg' },
{ angle: 45, src: 'img/face/north-east.jpg' },
{ angle: 90, src: 'img/face/east.jpg' },
{ angle: 135, src: 'img/face/south-east.jpg' },
{ angle: 180, src: 'img/face/south.jpg' },
{ angle: 225, src: 'img/face/south-west.jpg' },
{ angle: 270, src: 'img/face/west.jpg' },
{ angle: 315, src: 'img/face/north-west.jpg' }
]
})
Note: several point providers can work at the same time by using a comma-separated string like "random,pointer"
.
The following point providers are available out of the box:
pointer
for both mouse and touch events. This is the default.mouse
just for mouse events.finger
just for touch events.The are also external point providers:
npm start
will spin up a local server with the sample page watching your file changes.npm test
will run the tests.npm run build
will generate the production scripts under the dist
folder.Please feel free to create issues and / or submit pull requests. For the latter, test cases are very welcome.
MIT, see LICENSE for details.
Cross-browser Testing Platform and Open Source ❤️ provided by Sauce Labs.
FAQs
Creepyface is a little JavaScript library that makes your face look at the pointer.
The npm package creepyface receives a total of 43 weekly downloads. As such, creepyface popularity was classified as not popular.
We found that creepyface demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.