Analysis
千尋の元気が出るように
千尋 is the name of the main character.
の is the possessive particle and 元気 literally is “original spirit” which is used to mean “health, energy, strength”, and so on. So 千尋の元気 means “Chihiro’s energy or strength“.
“Noun が出る” means “something comes out“ or “something emerges“ so 元気が出る means “energy comes out” which can be translated as “to give you energy” or “give back your strength”.
And a verb dictionary form followed by ように means “so that”. You might know the similar word ために meaning “in order to” which is often mixed up with ように. They are very similar, but the implications and the types of the verb used with them are different.
- A ように B implies the clause A is a possible natural result of performing the clause B. So ように normally takes non-volitional verbs (無意志動詞) such as わかる (to understand), できる (can do), 聞こえる (to hear) and so on, which normally cannot be controlled by one’s will.
- A ために B is used in cases where clause A is a purpose or objective and the clause B is performed in order to achieve it. So ために normally takes volitional verbs (意志動詞) such as 知る (to know), する (to do), 聞く (to listen) and so on, which can be controlled by one’s will.
元気が出る meaning “energy comes out” is something that naturally occurs without intentions, so it’s used with ように. On the other hand, 元気を出す meaning “someone pulls out their energy” is what you intend to do so it’s used with ために.
So if he says 千尋の元気を出すために it sounds like he can control her energy at his will, whereas 千尋の元気がでるように indicates that Chihiro may naturally get back her strength as the result of his action.
まじないをかけて作ったんだ
まじない means “a spell”.
The を particle indicates the direct object of the following verb.
かけて is the te-form of かける. When it’s used with something thought to have magical powers like 魔法 (magic), 呪い (curse), 催眠術 (hypnotism) and so on, it means “to give effect to someone or something with the power”, so まじないをかける means “to cast a spell” and the te-form is used to mean “and” which links the two actions.
作った is the ta-form or the past tense of 作る meaning “to make“, so まじないをかけて作った means “cast a spell and made it”.
Lastly, んだ is used to add an explanatory tone to the statement so that it sounds persuasive and convincing.
すばらしい!ありがとう!