← 수업 제작 도구
홈 › Components › Graph and Graphing Calc › 화면 17

화면 17. Graph.background [sink]

원본: Computation Layer 문서(Graph) · Try It (원본 화면)

화면 번호17 / 29
문서 항목 설명 (원문)Sets the background layer of the graph.

1. 화면 캡처 (빨간 번호 = 아래 표의 번호)

화면 17 캡처

2. CL이 입력된 곳

코드 안의 회색 줄은 원문 영어 주석이고, 파란 줄은 그 영어 주석의 번역이며, 연분홍 줄은 코드가 하는 일의 설명이다.

번호이름종류CL 코드 원문, 번역, 설명
1master CL
(화면 전체)
SCREEN
subtitle: "Use the sketch tool draw a shape."
▶ 화면 제목 아래에 표시할 부제목(subtitle)은 "Use the sketch tool draw a shape."(스케치 도구를 사용해 도형을 그리시오.)로 한다.
2backgroundGraph그래프
# These are functions that transform the sketch. We then use
# layerStack to combine them into one layer.
▷ 그림판을 변형하는 함수들이다. 이어서 layerStack으로 이 함수들을 하나의 레이어로 합친다.

sketch1 = sketchLayer(sketchA.sketch.transform(
    simpleFunction("2x","x","y"),simpleFunction("2y","x","y")))
▶ 변수 sketch1은 그림판 sketchA의 스케치에서 x를 2x로, y를 2y로 바꾼 그림으로 만든 레이어(sketchLayer(sketchA.sketch.transform(simpleFunction("2x","x","y"),simpleFunction("2y","x","y"))))로 한다.
sketchA.sketch는 그림판 sketchA에 그린 스케치 전체를 가져오고, .transform(x 변환, y 변환)은 그림에 임의의 변환을 적용하되 그 변환을 함수 두 개로 정한다. simpleFunction(식, 변수…)는 LaTeX 글자로 쓴 식을 함수로 바꾸며, 첫 번째 인자는 식이고 나머지 인자는 입력 변수의 이름이다. simpleFunction("2x","x","y")는 x와 y를 입력으로 받아 2x를 계산하는 함수이고 simpleFunction("2y","x","y")는 2y를 계산하는 함수이다. 이 둘을 변환 함수로 넣으면 그림의 x와 y가 각각 2x, 2y로 바뀌어 그림이 2배로 커진다. sketchLayer(…)는 그림으로 레이어를 만든다.
sketch2 = sketchLayer(sketchA.sketch.transform( simpleFunction("4x","x","y"),simpleFunction("4y","x","y"))) sketch3 = sketchLayer(sketchA.sketch.transform( simpleFunction("6x","x","y"),simpleFunction("6y","x","y"))) sketch4 = sketchLayer(sketchA.sketch.transform( simpleFunction("7x","x","y"),simpleFunction("8y","x","y"))) sketch5 = sketchLayer(sketchA.sketch.transform( simpleFunction("10x","x","y"),simpleFunction("10y","x","y"))) ▶ 변수 sketch2~sketch5는 sketch1과 같은 방식으로, sketch2는 x와 y를 4배, sketch3은 6배, sketch4는 x를 7배·y를 8배, sketch5는 10배로 바꾼 그림의 레이어로 한다. # The background sink is used to set the background of the graph. ▷ background sink는 그래프의 배경을 정하는 데 사용한다. background: layerStack(sketch1,sketch2,sketch3,sketch4,sketch5) ▶ 그래프의 배경(background)은 sketch1~sketch5 레이어를 쌓은 것(layerStack(sketch1,sketch2,sketch3,sketch4,sketch5))으로 한다.
layerStack(…)은 레이어 다섯 개를 쌓아 하나의 레이어로 만든다. 학생이 그린 스케치가 서로 다른 크기로 여러 겹 쌓여 그래프 배경에 나타난다.