{
"$schema": "../../schemas/code-crispies-module-schema.json",
"id": "transitions-animations",
"title": "Animacje CSS",
"description": "Dodaj interaktywność do interfejsu poprzez płynne przejścia właściwości i animacje oparte na keyframes.",
"difficulty": "intermediate",
"lessons": [
{
"id": "transitions-1",
"title": "Transitions",
"description": "Naucz się jak stosować transition do właściwości dla płynnych zmian przy zmianie stanu.
transition: property duration;\n/* np. transition: background-color 0.3s; */", "task": "Dodaj transition: background-color 0.3s, aby kolor płynnie zmieniał się przy hover.", "previewHTML": "", "previewBaseCSS": "body { font-family: sans-serif; padding: 1rem; } .btn { background: black; color: white; padding: 0.5rem 1rem; border: none; cursor: pointer; } .btn:hover { background: white; color: black; }", "sandboxCSS": "", "codePrefix": "/* Add transition */\n.btn {", "initialCode": "", "codeSuffix": "}", "solution": " transition: background-color 0.3s;", "previewContainer": "preview-area", "validations": [ { "type": "contains", "value": "transition", "message": "Użyj właściwości transition", "options": { "caseSensitive": false } }, { "type": "regex", "value": "transition:\\s*background-color\\s*0\\.3s", "message": "Ustaw transition: background-color 0.3s", "options": { "caseSensitive": false } } ] }, { "id": "transitions-2", "title": "Timing Funcs", "description": "Poznaj funkcje easing jak ease, linear, ease-in, ease-out do kontrolowania tempa animacji.", "task": "Ustaw transition-timing-function na ease-in-out.", "previewHTML": "", "previewBaseCSS": "body { font-family: sans-serif; padding: 1rem; } .btn { background: navy; color: gold; padding: 0.5rem 1rem; border: none; cursor: pointer; transition: all 0.5s; } .btn:hover { background: gold; color: navy; transform: scale(1.1); }", "sandboxCSS": "", "codePrefix": "/* Set timing function */\n.btn {", "initialCode": "", "codeSuffix": "}", "solution": " transition-timing-function: ease-in-out;", "previewContainer": "preview-area", "validations": [ { "type": "contains", "value": "transition-timing-function", "message": "Użyj transition-timing-function", "options": { "caseSensitive": false } }, { "type": "property_value", "value": { "property": "transition-timing-function", "expected": "ease-in-out" }, "message": "Ustaw timing na ease-in-out" } ] }, { "id": "transitions-3", "title": "Keyframes", "description": "Twórz nazwane animacje używając @keyframes i stosuj je przez skrót animation.
@keyframes bounce {\n 50% { transform: translateY(-20px); }\n}\n.ball {\n animation: bounce 1s infinite;\n}",
"task": "Zdefiniuj keyframe przy 50% z transform: translateY(-20px) i zastosuj animation: bounce 1s infinite na .ball.",
"previewHTML": "",
"previewBaseCSS": "body { font-family: sans-serif; padding: 1rem; } .ball { width: 50px; height: 50px; background: crimson; border-radius: 50%; margin: 2rem auto; }",
"sandboxCSS": "",
"codePrefix": "/* Define keyframes and apply animation */\n@keyframes bounce {",
"initialCode": "",
"codeSuffix": "}\n.ball { }",
"solution": " 50% { transform: translateY(-20px); }\n}\n.ball {\n animation: bounce 1s infinite;",
"previewContainer": "preview-area",
"validations": [
{
"type": "contains",
"value": "@keyframes bounce",
"message": "Zdefiniuj @keyframes bounce",
"options": { "caseSensitive": false }
},
{
"type": "regex",
"value": "50%.*transform: translateY\\(-20px\\)",
"message": "Przy 50%, użyj transform: translateY(-20px)",
"options": { "caseSensitive": false }
},
{
"type": "contains",
"value": "animation",
"message": "Użyj właściwości animation na .ball",
"options": { "caseSensitive": false }
},
{
"type": "regex",
"value": "animation:.*bounce.*1s.*infinite",
"message": "Zastosuj animation: bounce 1s infinite",
"options": { "caseSensitive": false }
}
]
},
{
"id": "transitions-4",
"title": "Animation Properties",
"description": "Dostosuj animacje za pomocą animation-delay, animation-iteration-count, animation-direction i animation-fill-mode.",
"task": "Zastosuj animację pulse na .box z animation-name: pulse, animation-duration: 2s, animation-delay: 1s, animation-iteration-count: 2 i animation-fill-mode: forwards.",
"previewHTML": "