Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
DiceFace.svelte
DraggableList.svelte
<!--
출처:자작 보드게임 동아리 무지개
https://comic.naver.com/bestChallenge/detail.nhn?titleId=734597&no=58
카드 사용 무제한 버전
-->
<script>
import DraggableList from './DraggableList.svelte';
import DiceFace from './DiceFace.svelte';
const colors=['#ed2025','#f26722','#f3ec18','#69bd44','#3853a4','#3b3090','#7851a0'];
let cards=shuffle(colors.map((c,i)=>{ return {value:i+1,color:c}}));
let initialCards=cards.map((c)=>c.value);
let cardSorted=isSorted(cards);
let trial=0;
const timer=setInterval(()=>{elapsedTime+=0.1},100);
let elapsedTime=0;
$: formatted=Math.round(elapsedTime*10)/10;
let commandLog=[];
function commandLogger(card, from, to)
{
console.log(card, from, to)
commandLog=[...commandLog,`${card[0]}${from}${to}`];
}
function reset(){
cards=shuffle(colors.map((c,i)=>{ return {value:i+1,color:c}}));
initialCards=cards.map((c)=>c.value);
cardSorted=isSorted(cards);
trial=0;
elapsedTime=0;
commandLog=[];
}
function shuffle(arr)
{
let result=[];
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */