- Notifications
You must be signed in to change notification settings - Fork240
Astro -ultra#73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
Bopda-joan-kelian wants to merge1 commit intogithub:tarebyte/document-changesChoose a base branch fromBopda-joan-kelian:patch-1
base:tarebyte/document-changes
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Astro -ultra#73
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
127 changes: 127 additions & 0 deletionsAstro -ultra
This file contains hidden or 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,127 @@ | ||
<!DOCTYPE html> | ||
<html lang="fr"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
<link rel="manifest" href="manifest.json"> | ||
<link rel="stylesheet" href="style.css" /> | ||
<title>Astro Ultra</title> | ||
</head> | ||
<body> | ||
<div id="app"> | ||
<div id="astro-face"> | ||
<img src="assets/astro.png" id="astro-img" alt="Astro" /> | ||
<div id="mouth-animation"></div> | ||
</div> | ||
<div id="response"></div> | ||
<button onclick="startListening()">🎤 Parler</button> | ||
<canvas id="simulation-canvas"></canvas> | ||
</div> | ||
<script src="main.js"></script> | ||
<script src="simulation.js"></script> | ||
</body> | ||
</html>body { | ||
background: radial-gradient(circle at center, #000 40%, #0a0a2a 100%); | ||
font-family: sans-serif; | ||
color: white; | ||
text-align: center; | ||
} | ||
#astro-face { | ||
position: relative; | ||
} | ||
#astro-img { | ||
width: 200px; | ||
} | ||
#mouth-animation { | ||
position: absolute; | ||
bottom: 40px; | ||
left: 90px; | ||
width: 20px; | ||
height: 20px; | ||
background: red; | ||
border-radius: 50%; | ||
animation: speak 1s infinite alternate; | ||
} | ||
@keyframes speak { | ||
from { transform: scaleY(1); } | ||
to { transform: scaleY(2); } | ||
} | ||
#simulation-canvas { | ||
margin-top: 20px; | ||
width: 300px; | ||
height: 200px; | ||
background: #111; | ||
border: 1px solid white; | ||
}const synth = window.speechSynthesis; | ||
const recognition = window.SpeechRecognition || window.webkitSpeechRecognition; | ||
const recog = new recognition(); | ||
function speak(text) { | ||
const utter = new SpeechSynthesisUtterance(text); | ||
synth.speak(utter); | ||
document.getElementById("mouth-animation").style.animationPlayState = 'running'; | ||
utter.onend = () => { | ||
document.getElementById("mouth-animation").style.animationPlayState = 'paused'; | ||
}; | ||
} | ||
function startListening() { | ||
recog.start(); | ||
recog.onresult = function(e) { | ||
const input = e.results[0][0].transcript; | ||
document.getElementById("response").textContent = "Vous : " + input; | ||
let reply = "Je pense à cela..."; | ||
if (input.includes("masse négative")) reply = "Simulation de masse négative en cours..."; | ||
document.getElementById("response").textContent += "\nAstro : " + reply; | ||
speak(reply); | ||
}; | ||
}const canvas = document.getElementById('simulation-canvas'); | ||
const ctx = canvas.getContext('2d'); | ||
let x = 150, y = 100, vx = -1; | ||
function draw() { | ||
ctx.clearRect(0, 0, canvas.width, canvas.height); | ||
ctx.beginPath(); | ||
ctx.arc(x, y, 10, 0, Math.PI * 2); | ||
ctx.fillStyle = "cyan"; | ||
ctx.fill(); | ||
ctx.closePath(); | ||
x += vx; | ||
if (x < 0 || x > canvas.width) vx *= -1; | ||
requestAnimationFrame(draw); | ||
} | ||
draw();{ | ||
"name": "Astro Ultra", | ||
"short_name": "Astro", | ||
"start_url": "./index.html", | ||
"display": "standalone", | ||
"background_color": "#000000", | ||
"theme_color": "#0a0a2a", | ||
"icons": [{ | ||
"src": "assets/icon.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}] | ||
}self.addEventListener('install', function(e) { | ||
e.waitUntil( | ||
caches.open('astro-ultra').then(function(cache) { | ||
return cache.addAll([ | ||
'./', | ||
'./index.html', | ||
'./style.css', | ||
'./main.js', | ||
'./simulation.js' | ||
]); | ||
}) | ||
); | ||
}); | ||
self.addEventListener('fetch', function(e) { | ||
e.respondWith( | ||
caches.match(e.request).then(function(response) { | ||
return response || fetch(e.request); | ||
}) | ||
); | ||
});{ | ||
"memory": [] | ||
} |
43 changes: 0 additions & 43 deletionsREADME.md
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.